package com.nbsaas.boot.cms.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "导航菜单", model = "导航菜单")
@Entity
@Table(name = "bs_navigation")
@Comment("导航菜单表")
public class Navigation extends AbstractEntity {

    @Comment("菜单名称")
    @SearchItem(name = "name", key = "name", label = "菜单名称")
    @FormField(title = "菜单名称", sortNum = "1", grid = true, required = true)
    @Column(length = 100, nullable = false)
    private String name;

    @Comment("菜单链接")
    @FormField(title = "菜单链接", sortNum = "2", grid = true)
    @Column(length = 500)
    private String url;

    @Comment("菜单图标")
    @FormField(title = "菜单图标", sortNum = "3", type = InputType.image)
    @Column(length = 500)
    private String icon;

    @Comment("父菜单ID")
    @FormField(title = "父菜单ID", sortNum = "4", grid = true, type = InputType.select)
    private Long parentId;

    @Comment("菜单类型")
    @FormField(title = "菜单类型", sortNum = "5", grid = true, type = InputType.select)
    @Column(length = 20)
    private String menuType; // LINK-链接, PAGE-页面, ARTICLE-文章, CATEGORY-分类

    @Comment("关联ID")
    @FormField(title = "关联ID", sortNum = "6", grid = true)
    private Long relatedId;

    @Comment("排序")
    @FormField(title = "排序", sortNum = "7", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("是否显示")
    @FormField(title = "是否显示", sortNum = "8", grid = true, type = InputType.select)
    private Boolean visible;

    @Comment("是否新窗口打开")
    @FormField(title = "是否新窗口打开", sortNum = "9", grid = true, type = InputType.select)
    private Boolean newWindow;

    @Comment("菜单位置")
    @FormField(title = "菜单位置", sortNum = "10", grid = true, type = InputType.select)
    @Column(length = 20)
    private String position; // HEADER-头部, FOOTER-底部, SIDEBAR-侧边栏

    @Comment("菜单描述")
    @FormField(title = "菜单描述", sortNum = "11", type = InputType.textarea)
    @Column(length = 500)
    private String description;

    @Comment("CSS类名")
    @FormField(title = "CSS类名", sortNum = "12")
    @Column(length = 200)
    private String cssClass;

    @Comment("目标用户")
    @FormField(title = "目标用户", sortNum = "13", grid = true, type = InputType.select)
    @Column(length = 20)
    private String targetUser; // ALL-所有用户, GUEST-游客, USER-登录用户, VIP-VIP用户
} 